import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
    state: () => ({
        userInfo: JSON.parse(localStorage.getItem('userInfo') || '{}')
    }),
    actions: {
        updateUserInfo(newInfo: any) {
            this.userInfo = newInfo
            localStorage.setItem('userInfo', JSON.stringify(newInfo))
        }
    }
})